import { use, useEffect, useState } from "react";
import { store } from ".";
import { Button } from "antd";
import ReduxContext from "./context";
import ConnectTest from "./ConnectTest";
export default function ReduxTest() {
  const [count, setCount] = useState(1);
  const [age, setAge] = useState(18);
  useEffect(() => {
    store.subscribe(() => {
      let cut = store.getState();
      setCount(() => cut.counter.Count);
      setAge(() => cut.info.age);
    });
  });
  return (
    <div>
      {/* <h1>
        count is {count} age is {age}
        <Button onClick={() => store.dispatch({ type: "addCount" })}>add</Button>
      </h1> */}

      <ReduxContext.Provider value={store}>
        <ConnectTest />
      </ReduxContext.Provider>
    </div>
  );
}
